﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>报警信息发送记录</title>
    <meta name="description" content="">
    <meta name="author" content="">

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <!-- #CSS Links -->
    <!-- Basic Styles -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" media="screen" href="css/font-awesome.css">

    <!-- SmartAdmin Styles : Caution! DO NOT change the order -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-production-plugins.css">
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-production.css">
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-skins.css">

    <!-- SmartAdmin RTL Support -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-rtl.css">

    <!-- Demo purpose only: goes with demo.js, you can delete this css when designing your own WebApp -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/demo.css">

    <!-- #FAVICONS -->
    <link rel="shortcut icon" href="img/favicon/favicon.ico" type="image/x-icon">
    <link rel="icon" href="img/favicon/favicon.ico" type="image/x-icon">

    <!-- #GOOGLE FONT -->
    <link rel="stylesheet" href="css/open-sans.css" type="text/css">

    <!-- #APP SCREEN / ICONS -->
    <link rel="apple-touch-icon" href="img/splash/sptouch-icon-iphone.png">
    <link rel="apple-touch-icon" sizes="76x76" href="img/splash/touch-icon-ipad.png">
    <link rel="apple-touch-icon" sizes="120x120" href="img/splash/touch-icon-iphone-retina.png">
    <link rel="apple-touch-icon" sizes="152x152" href="img/splash/touch-icon-ipad-retina.png">

    <!-- iOS web-app metas : hides Safari UI Components and Changes Status Bar Appearance -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <!-- Startup image for web apps -->
    <link rel="apple-touch-startup-image" href="img/splash/ipad-landscape.png"
          media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)">
    <link rel="apple-touch-startup-image" href="img/splash/ipad-portrait.png"
          media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)">
    <link rel="apple-touch-startup-image" href="img/splash/iphone.png" media="screen and (max-device-width: 320px)">
    <link href="appcss/Common.css" rel="stylesheet" />

    <style>
        .dt-toolbar div .dataTables_filter {
            width: auto !important;
        }
    </style>
</head>
<body class="desktop-detected minified">
    <!-- #MAIN PANEL -->
    <div id="main" role="main">
        <!-- RIBBON -->
        <div id="ribbon">
            <span class="ribbon-button-alignment">
                <span class="btn btn-ribbon"><i class="fa fa-home"></i></span>
            </span>
            <!-- breadcrumb -->
            <ol class="breadcrumb">
                <li>报警信息发送记录</li>
            </ol>
            <!-- end breadcrumb -->
        </div>
        <!-- END RIBBON -->
        <!-- MAIN CONTENT -->
        <div id="content">
            <div class="row hidden">
                <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4">
                    <h2 class="page-title txt-color-blueDark">
                        <i class="fa fa-table fa-fw "></i>
                        主页
                        <span>
                            报警信息发送记录
                        </span>
                    </h2>
                </div>
            </div>
            <!-- widget grid -->
            <section id="widget-grid" class="">
                <!-- row -->
                <div class="row" style="margin-top: 8px;">
                    <!-- NEW WIDGET START -->
                    <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12 sortable-grid ui-sortable">
                        <!-- Widget ID (each widget will need unique ID)-->
                        <div class="jarviswidget jarviswidget-sortable" id="wid-id-0"
                             data-widget-editbutton="false">
                            <header>
                                <span class="widget-icon"><i class="fa fa-table"></i></span>
                                <h2>报警信息发送记录列表</h2>
                            </header>
                            <!-- widget div-->
                            <div>
                                <!-- widget edit box -->
                                <div class="jarviswidget-editbox">
                                    <!-- This area used as dropdown edit box -->
                                </div>
                                <!-- end widget edit box -->
                                <!-- widget content -->
                                <div class="widget-body">
                                    <ul class="demo-btns">
                                        <li>
                                            标题
                                            <input id="ctlEditFilter" style="width:150px" />
                                            地址
                                            <input id="address" style="width:150px" />
                                            状态
                                            <select name="state" id="state">
                                                <option value="">全部</option>
                                                <option value="1">成功</option>
                                                <option value="0">发送中</option>
                                                <option value="-1">失败</option>
                                            </select>
                                            方式
                                            <select name="state" id="type">
                                                <option value="">全部</option>
                                                <option value="1">短信</option>
                                                <option value="2">邮箱</option>
                                            </select>
                                            起始日期
                                            <input id="begindate" class='Wdate' onclick="WdatePicker(({ dateFmt: 'yyyy-MM-dd HH:mm:ss' }))" style="width:150px" />
                                            截至日期
                                            <input id="enddate" style="width:150px" class='Wdate' onclick="WdatePicker(({ dateFmt: 'yyyy-MM-dd HH:mm:ss' }))" />
                                            <a class="btn  btn-default btn-xs" href="javascript:table.fnDraw();">刷新 </a>
                                        </li>
                                    </ul>
                                    <div class="table-responsive">
                                        <table class="table table-bordered table-hover smart-form" id="datalist-table">
                                            <thead>
                                                <tr>
                                                    <th>方式</th>
                                                    <th>状态</th>
                                                    <th>时间</th>
                                                    <th>地址</th>
                                                    <th>标题</th>
                                                    <th>内容</th>
                                                </tr>
                                            </thead>
                                            <tbody></tbody>
                                        </table>

                                    </div>

                                </div>
                                <!-- end widget content -->

                            </div>
                            <!-- end widget div -->
                        </div>
                        <!-- end widget -->
                    </article>
                </div>
                <!-- end row -->
            </section>
            <!-- end widget grid -->
        </div>
        <!-- END MAIN CONTENT -->
    </div>

    <!-- END #MAIN CONTENT -->
    <!--================================================== -->
    <!-- PACE LOADER - turn this on if you want ajax loading to show (caution: uses lots of memory on iDevices)
    <script data-pace-options='{ "restartOnRequestAfter": true }' src="js/plugin/pace/pace.min.js"></script>-->
    <!-- #PLUGINS -->
    <!-- Link to Google CDN's jQuery + jQueryUI; fall back to local -->


    <script src="js/libs/jquery-2.1.1.min.js"></script>
    <script src="js/libs/jquery-ui-1.10.3.min.js"></script>
    <!-- BOOTSTRAP JS -->
    <script src="js/bootstrap/bootstrap.min.js"></script>

    <!-- IMPORTANT: APP CONFIG -->
    <script src="js/app.config.js"></script>


    <!-- CUSTOM NOTIFICATION -->
    <script src="js/notification/SmartNotification.min.js"></script>

    <!-- JARVIS WIDGETS -->
    <script src="js/smartwidgets/jarvis.widget.min.js"></script>


    <!-- SPARKLINES -->
    <script src="js/plugin/sparkline/jquery.sparkline.min.js"></script>

    <!-- JQUERY MASKED INPUT -->
    <script src="js/plugin/masked-input/jquery.maskedinput.min.js"></script>


    <!-- JQUERY UI + Bootstrap Slider -->
    <script src="js/plugin/bootstrap-slider/bootstrap-slider.min.js"></script>


    <!--[if IE 8]>
    <h1>Your browser is out of date, please update your browser by going to www.microsoft.com/download</h1>
    <![endif]-->
    <!-- Demo purpose only
    <script src="js/demo.min.js"></script>
    -->
    <!-- MAIN APP JS FILE -->
    <script src="js/plugin/datatables/jquery.dataTables.min.js"></script>
    <script src="js/plugin/datatables/dataTables.colVis.min.js"></script>
    <script src="js/plugin/datatables/dataTables.tableTools.min.js"></script>
    <script src="js/plugin/datatables/dataTables.bootstrap.min.js"></script>
    <script src="js/plugin/jquery-validate/jquery.validate.min.js"></script>
    <script src="js/plugin/datatable-responsive/datatables.responsive.min.js"></script>
    <script src="js/plugin/My97DatePicker/WdatePicker.js"></script>
    <script src="appjs/Common.js"></script>
    <script src="appjs/Helper.js"></script>
    <script>
        var draw = 0;
        var serviceId = GetQueryString("Id");
        $(function () {
            //初始化表格
            var initializationDataTable = function () {
                this.table = $('#datalist-table').dataTable({
                    "autoWidth": true,
                    "oLanguage": dataTableConfig,
                    "bLengthChange": false,
                    ordering: false,
                    bProcessing: true,
                    bStateSave: true,
                    serverSide: true,
                    searching: false,
                    aLengthMenu: [25],
                    "ajax": {
                        url: g_webApiBaseUrl + 'Query/MessageAlertRecord',
                        "dataSrc": function (json) {
                            if (json.IsSuccess) {
                                var newjson = new Array();
                                for (var i = 0; i < json.Data.Items.length; i++) {
                                    newjson.push({
                                        'content': json.Data.Items[i].Content,
                                        'state': GetIsSuccessName(json.Data.Items[i].IsSuccess),
                                        'alertType': GetAlertTypeName(json.Data.Items[i].AlertType),
                                        'createdTime': json.Data.Items[i].CreatedTime.replace("T", " "),
                                        'address': json.Data.Items[i].Address,
                                        'title': json.Data.Items[i].Title
                                    });
                                }
                                return newjson;
                            } else {
                                if (IsLogined(json.ErrorCode)) {
                                    alert("失败（" + "错误代码：" + json.ErrorCode + "，错误信息：" + json.Message + ")");
                                }
                            }
                            return [];
                        },
                        "data": function (d) {
                            draw = d.draw;
                            return $.extend({},
                                { "filter": $('#ctlEditFilter').val() },
                                { "begindate": $('#begindate').val() },
                                { "enddate": $('#enddate').val() },
                                { "state": $('#state').val() },
                                { "type": $('#type').val() },
                                { "address": $('#address').val() },
                                { "length": d.length },
                                { "Page": parseInt(d.start / d.length) });
                        }
                    },
                    columns: [
                        { data: 'alertType' },
                        { data: 'state' },
                        { data: 'createdTime' },
                        { data: 'address' },
                        { data: 'title' },
                        { data: 'content' }
                    ]
                });
            }

            initializationDataTable();
        });


        var GetIsSuccessName = function (id) {
            var str = "";
            switch (id) {
                case 1:
                    str = "成功";
                    break;
                case -1:
                    str = "失败";
                    break;
                case 0:
                    str = "发送中";
                    break;
            }
            return str;
        }

        var GetAlertTypeName = function (id) {
            var str = "";
            switch (id) {
                case 1:
                    str = "短信";
                    break;
                case 2:
                    str = "邮箱";
                    break;
            }
            return str;
        }
    </script>
</body>
</html>

